package com.project.controller;

import com.project.bean.PieBean;
import com.project.service.IPieService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

/**
 * 月销售统计控制器
 */
@RestController
@RequestMapping("pie")
@RequiresPermissions("pie:am")
public class PieController {
    @Autowired
    private IPieService pieService;
    @RequestMapping("findClassesSale")
    public List<PieBean> findClassesSale(LocalDate startDate, LocalDate endDate){
        return pieService.findClassesSale(startDate, endDate);
    }

    /**
     * 根据起始日期、结束日期，统计每个品牌，每个类别的销售额
     * @param startDate 起始日期
     * @param endDate 结束日期
     * @return 销售统计对象
     */
    @RequestMapping("findBrandClassesSale")
    public List<PieBean> findBrandClassesSale(LocalDate startDate,LocalDate endDate){
        return pieService.findBrandClassesSale(startDate, endDate);
    }
}
